var e = require;
var t = module;
var o = exports;
var n,
    i = o,
    a =
        ((n = function (e, t) {
            return (n =
                Object.setPrototypeOf ||
                ({__proto__: []} instanceof Array &&
                    function (e, t) {
                        e.__proto__ = t;
                    }) ||
                function (e, t) {
                    for (var o in t) t.hasOwnProperty(o) && (e[o] = t[o]);
                })(e, t);
        }),
        function (e, t) {
            function o() {
                this.constructor = e;
            }
            n(e, t), (e.prototype = null === t ? Object.create(t) : ((o.prototype = t.prototype), new o()));
        }),
    r = function (e, t, o, n) {
        var i,
            a = arguments.length,
            r = a < 3 ? t : null === n ? (n = Object.getOwnPropertyDescriptor(t, o)) : n;
        if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(e, t, o, n);
        else
            for (var s = e.length - 1; s >= 0; s--)
                (i = e[s]) && (r = (a < 3 ? i(r) : a > 3 ? i(t, o, r) : i(t, o)) || r);
        return a > 3 && r && Object.defineProperty(t, o, r), r;
    };
Object.defineProperty(i, "__esModule", {value: !0});
var s = e("GameModuleView"),
    c = cc._decorator,
    l = c.ccclass,
    d = c.property,
    u = (function (e) {
        function t() {
            var t = (null !== e && e.apply(this, arguments)) || this;
            return (t.testNode = null), (t.nodePool = new cc.NodePool()), (t.map = new Map()), t;
        }
        return (
            a(t, e),
            (t.prototype.addNode = function (e, t) {
                void 0 === t && (t = null);
                var o = s.default.Insance.snakeGridMap.getCenterPosByIndex(e),
                    n = this.getNode();
                (n.height = s.default.Insance.snakeGridMap.unitHeight),
                    (n.width = s.default.Insance.snakeGridMap.unitWidth),
                    this.map.set(e, n),
                    this.node.addChild(n),
                    cc.isValid(t) ? (n.position = t) : (n.position = o);
            }),
            (t.prototype.removeNode = function (e) {
                if (this.map.has(e)) {
                    var t = this.map.get(e);
                    this.setNode(t), this.map.delete(e);
                }
            }),
            (t.prototype.getNode = function () {
                return this.nodePool.size() <= 0 ? cc.instantiate(this.testNode) : this.nodePool.get();
            }),
            (t.prototype.setNode = function (e) {
                this.nodePool.put(e);
            }),
            r([d(cc.Prefab)], t.prototype, "testNode", void 0),
            r([l], t)
        );
    })(cc.Component);
i.default = u;
